<?php

namespace app\common\model;

use think\Model;

class CourseStateModel extends Model
{
    protected $table = 'edu_course_state';
    protected $append = ['image','videos'];

    public function school(){
        return $this->belongsTo('SchoolModel','school_id');
    }

    public function course(){
        return $this->belongsTo('CourseModel','course_id');
    }

    public function getImageAttr($value,$data)
    {
        return explode(",", $data['images']);
    }

    public function getVideosAttr($value,$data)
    {
        return explode(",", $data['video']);
    }

    public function getDescAttr($value)
    {
        return utf8_decode($value);
    }

    public function setDescAttr($value,$data)
    {
        return utf8_encode($value);
    }
}